fix: repair cross-package test failures and type errors - #101
Open
stooit wants to merge 1 commit into
Open
Conversation
- restore useSearchDebounce export alias (hook renamed to useDebounce) - preload happy-dom in root bunfig.toml so component tests have a DOM - forward aria-label and default it for iconOnly Buttons (WCAG 4.1.2) - format dates day-first with unpadded day and 4-digit year (en-AU) - add DOM/test types in tsconfig so tsc --noEmit is clean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing
bun testcases andtsc --noEmiterrors across the monorepo. All bugs spanned package boundaries. No test files were modified and no dependencies were added.Final state: 13 pass / 0 fail and
tsc --noEmitexits clean.Fixes
apps/web/src/lib/api.ts— renamed-hook import. The hook was renamed touseDebounceinpackages/utils, butapps/webstill imported/re-exported the old name. Updated the import and re-export asexport { useDebounce as useSearchDebounce }so the publicuseSearchDebouncename still resolves (satisfiesapps/web/test/api.test.ts).bunfig.toml— test DOM environment. The root config usedenvironment = "happy-dom", which is Vitest/Jest syntax that Bun ignores, sodocumentwas undefined and every React component test failed. Switched to Bun's[test] preloadof the existing happy-dom setup so component tests get a DOM globally.packages/ui/.../Button.tsx— accessible name. Now forwards an explicitaria-labelto the rendered<button>, and applies a defaultaria-labelforiconOnlybuttons that don't provide one (WCAG 2.2 SC 4.1.2).packages/utils/.../date.ts— locale/format.formatDatenow produces a day-firstDD/MM/YYYY(en-AU) string with an unpadded day and 4-digit year viaIntl.DateTimeFormat.formatToParts(e.g.15/6/2024,1/3/2024), fixing the previous01/03/2024output.tsconfig.json— added DOM/test lib+types sotsc --noEmitis clean.Notes / assumptions
iconOnlyButton default aria-label falls back to a generic label when none is supplied.Verification
bun test→ 13 pass, 0 failbunx tsc --noEmit→ exit 0